package com.eastidea.live.util;

import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.List;

import org.im4java.core.ConvertCmd;

public class ForWinConvertCmd extends ConvertCmd {

	public ForWinConvertCmd() {
		initForWin();
	}

	public ForWinConvertCmd(boolean useGM) {
		super(useGM);
		initForWin();
	}

	protected void initForWin() {
		if (System.getProperty("os.name").startsWith("Windows"))
			try {
				Field field = getClass().getSuperclass().getSuperclass()
						.getDeclaredField("iCommands");
				field.setAccessible(true);
				List value = (List) field.get(this);
				value.addAll(0, Arrays.asList(new String[] { "cmd", "/C" }));
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
	}
}
